<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">    
<head>
<%@page import="java.util.*"%>
<%@page import="edu.byu.isys413.group1E.handlers.*"%>
<%@page import="edu.byu.isys413.group1E.data.*"%>
<%@page import="java.util.ArrayList.*"%>
<%@page import="java.text.DecimalFormat"%>
    
<%   
TransactionBO TXBO = (TransactionBO)request.getAttribute("TX");
ArrayList<TransLineBO> TLList = TXBO.getTxLineList();
DecimalFormat fmt = new DecimalFormat();
fmt.setMinimumFractionDigits(2);
fmt.setMaximumFractionDigits(2);    
%>
    
    
    
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Checkout</title>
<style type="text/css">
<!--
body,td,th {
	font-family: tahoma;
}
body {
	background-color: #354153;
}
.title {background-color: #708BB2; 
color:#FFFFFF; padding:5px; 
font-size:12px; 
font-weight:bold; 
border:1px solid; 
width:492px;
}
.tablething {border-collapse:collapse; color:#FFFFFF; font-size:10px; border-left:2px solid;
}
.add {background-image:url(images/remove.gif); 
width:12px; 
height:12px; 
border:0px; 
padding:0px; 
margin:0px;
}
.bottom {background-color: #708BB2; 
color:#FFFFFF; padding:1px; 
font-size:8px;  border:1px solid; 
width:232px; height:40px;
}
-->
</style></head>

<body  onload="parent.clear = false;">
<div class="title">
  <table border="0" cellspacing="0" cellpadding="3" style="padding:0px;">
    <tr>
      <td width="25"><img src="images/shoppingcart.gif" width="25" height="23" /></td>
      <td width="100%">Checkout Shopping Cart Order </td>
    </tr>
  </table>
</div>
<div style="border-color:#FFFFFF; height:340px; width:504px; overflow:auto; border-left:1px #FFFFFF; " align="right">
  <table width="100%" height="220" border="1" cellspacing="0" cellpadding="3" bordercolor="#FFFFFF"  class="tablething">
    <!-- THIS IS THE LOOP -->
    <tr>
      <td valign="top" align="center">
	  
	  
        <table width="100%" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td colspan="2"><strong>Please Review Transaction Items: </strong></td>
          </tr>
          <tr>
           <td width="50%">        <div style="border-color: rgb(255, 255, 255); border:1px solid; overflow: auto; height: 200px; width: 100%;" align="right">
          <table class="tablething" border="1" bordercolor="#ffffff" cellpadding="3" cellspacing="0" width="100%" style="border-left:0px; border-right:0px; border-color:#FFFFFF;">
            <!-- THIS IS THE LOOP -->
            <%for(int counter = 0; counter<TLList.size(); counter++) {   %>
                <tbody><tr>                        
                            <td><%=TLList.get(counter).getRevSrc().getDescription()%></td>
                            <%String lineAmount = fmt.format(TLList.get(counter).getLineAmount());  %>
                            <td align="right" width="30">$<%=lineAmount%></td>
                    </tr>
                    <% }//end for Loop%>
            </tbody></table>
        </table>
    </div>        
        <div class="bottom" style="width:230px; position:relative; left:1px;" >
        <table border="1" cellpadding="0" cellspacing="0" width="100%" style="font-size:10px; border-collapse:collapse; border-color:#CCCCCC;">
          <tbody>
            <tr>
                <%String subTotal = fmt.format(TXBO.getTransSubTotal());  
                String tax = fmt.format(TXBO.getTransTax()); 
                String total = fmt.format(TXBO.getTransTotal()); 
                %>
                <td align="center"><strong style="color:#333333;">Subtotal</strong></td>
                <td align="center"><strong style="color:#333333;">Tax</strong></td>
                <td align="center">
                <div style="border: 3px double; border-color: #990000;">
                <strong style="color:#000000;">Total</strong></div>		
            </tr>
            <tr>

              <td align="center"><strong style="color:#333333;">$<%=subTotal%></strong></td>
              <td align="center"><strong style="color:#333333;">$<%=tax%></strong></td>
              <td align="center"><div style="border: 3px double; border-color: #990000;"> <strong style="color:#000000;">$<%=total%></strong></div></td>
            </tr>
          </tbody>
        </table>
      </div>   </td>
            <td valign="top" width="50%" align="center"><strong>Please Verify your Account Information : <br />  
            <br />
            </strong></p>

                <%String name = TXBO.getCustomer().getCustFullName();  
                String email = TXBO.getCustomer().getCustEmail(); 
                String ccType = TXBO.getCustomer().getCustMembership().getCreditCardType(); 
                String ccNum = TXBO.getCustomer().getCustMembership().getCreditCardNum();
                int ccExpMo = TXBO.getCustomer().getCustMembership().getCreditCardExpMonth();
                int ccExpYr = TXBO.getCustomer().getCustMembership().getCreditCardExpYear(); 
                String txguid = TXBO.getTransID();
                %>
                  <table border="0" cellspacing="0" cellpadding="3">
                    <tr>
                      <td width="100"  align="right">Name:</td>
                      <td width="200"><%=name%></td>
                    </tr>
                    <tr>
                      <td width="100" align="right">Email:</td>
                      <td width="200"><%=email%></td>
                    </tr>
                    <tr>
                      <td colspan="2"><hr /></td>
                    </tr>
                    <tr>
                      <td width="100" align="right">Credit Card: </td>
                      <td width="200"><img src="images/<%=ccType%>.gif" /> <%=ccNum%></td>
                    </tr>
                    <tr>
                      <td width="100" align="right">Expiration Date: </td>
                      <td width="200"><%=ccExpMo%>/<%=ccExpYr%></td>
                    </tr>
        </table>            </td>
          </tr>
</table>
  </td>
  </tr>
  </table>
  </div>
  <table width="100%" border="0" cellspacing="0" cellpadding="3" align="right" style="margin:0px; position:relative; top:-30px;">
    <tr>
      <td>  <table border="0" cellspacing="0" cellpadding="3" width="100" align="right" style="margin:0px">
    <tr>

      <td ><form id="cancel" name="cancel"  method="post" action="edu.byu.isys413.actions.revieworder.action" style="margin:0px;">
	  <input type="hidden" name="txguid"   value="<%=txguid%>" />
          <input type="submit" name="Submit2" value="Cancel and Review"  onclick="parent.cart.document.getElementById('shade').style.visibility = 'hidden';"/>
      </form></td>
      <td ><form id="confirm" name="confirm" method="post" action="edu.byu.isys413.actions.completetransaction.action" style="margin:0px;">
        

          <input type="submit" name="Submit" value="Confirm and Checkout"  onclick="parent.cart.location.href = 'news.jsp';"/>
      </form></td>
    </tr>
  </table></td>
    </tr>
  </table>
</body>
</html>
